Optimal. Leaf size=92 \[ \frac {h x}{c}-\frac {\left (2 c^2 f-b c g+b^2 h-2 a c h\right ) \tanh ^{-1}\left (\frac {b+2 c x}{\sqrt {b^2-4 a c}}\right )}{c^2 \sqrt {b^2-4 a c}}+\frac {(c g-b h) \log \left (a+b x+c x^2\right )}{2 c^2} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.08, antiderivative size = 92, normalized size of antiderivative = 1.00, number of steps
used = 6, number of rules used = 5, integrand size = 23, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.217, Rules used = {1671, 648, 632,
212, 642} \begin {gather*} -\frac {\tanh ^{-1}\left (\frac {b+2 c x}{\sqrt {b^2-4 a c}}\right ) \left (-2 a c h+b^2 h-b c g+2 c^2 f\right )}{c^2 \sqrt {b^2-4 a c}}+\frac {(c g-b h) \log \left (a+b x+c x^2\right )}{2 c^2}+\frac {h x}{c} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 212
Rule 632
Rule 642
Rule 648
Rule 1671
Rubi steps
\begin {align*} \int \frac {f+g x+h x^2}{a+b x+c x^2} \, dx &=\int \left (\frac {h}{c}+\frac {c f-a h+(c g-b h) x}{c \left (a+b x+c x^2\right )}\right ) \, dx\\ &=\frac {h x}{c}+\frac {\int \frac {c f-a h+(c g-b h) x}{a+b x+c x^2} \, dx}{c}\\ &=\frac {h x}{c}+\frac {(c g-b h) \int \frac {b+2 c x}{a+b x+c x^2} \, dx}{2 c^2}+\frac {\left (2 c^2 f-b c g+b^2 h-2 a c h\right ) \int \frac {1}{a+b x+c x^2} \, dx}{2 c^2}\\ &=\frac {h x}{c}+\frac {(c g-b h) \log \left (a+b x+c x^2\right )}{2 c^2}-\frac {\left (2 c^2 f-b c g+b^2 h-2 a c h\right ) \text {Subst}\left (\int \frac {1}{b^2-4 a c-x^2} \, dx,x,b+2 c x\right )}{c^2}\\ &=\frac {h x}{c}-\frac {\left (2 c^2 f-b c g+b^2 h-2 a c h\right ) \tanh ^{-1}\left (\frac {b+2 c x}{\sqrt {b^2-4 a c}}\right )}{c^2 \sqrt {b^2-4 a c}}+\frac {(c g-b h) \log \left (a+b x+c x^2\right )}{2 c^2}\\ \end {align*}
________________________________________________________________________________________
Mathematica [A]
time = 0.04, size = 95, normalized size = 1.03 \begin {gather*} \frac {h x}{c}+\frac {\left (2 c^2 f-b c g+b^2 h-2 a c h\right ) \tan ^{-1}\left (\frac {b+2 c x}{\sqrt {-b^2+4 a c}}\right )}{c^2 \sqrt {-b^2+4 a c}}+\frac {(c g-b h) \log \left (a+b x+c x^2\right )}{2 c^2} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [A]
time = 0.16, size = 93, normalized size = 1.01
method | result | size |
default | \(\frac {h x}{c}+\frac {\frac {\left (-b h +c g \right ) \ln \left (c \,x^{2}+b x +a \right )}{2 c}+\frac {2 \left (-a h +c f -\frac {\left (-b h +c g \right ) b}{2 c}\right ) \arctan \left (\frac {2 c x +b}{\sqrt {4 a c -b^{2}}}\right )}{\sqrt {4 a c -b^{2}}}}{c}\) | \(93\) |
risch | \(\text {Expression too large to display}\) | \(1649\) |
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [F(-2)]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {Exception raised: ValueError} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [A]
time = 0.37, size = 302, normalized size = 3.28 \begin {gather*} \left [\frac {2 \, {\left (b^{2} c - 4 \, a c^{2}\right )} h x - {\left (2 \, c^{2} f - b c g + {\left (b^{2} - 2 \, a c\right )} h\right )} \sqrt {b^{2} - 4 \, a c} \log \left (\frac {2 \, c^{2} x^{2} + 2 \, b c x + b^{2} - 2 \, a c + \sqrt {b^{2} - 4 \, a c} {\left (2 \, c x + b\right )}}{c x^{2} + b x + a}\right ) + {\left ({\left (b^{2} c - 4 \, a c^{2}\right )} g - {\left (b^{3} - 4 \, a b c\right )} h\right )} \log \left (c x^{2} + b x + a\right )}{2 \, {\left (b^{2} c^{2} - 4 \, a c^{3}\right )}}, \frac {2 \, {\left (b^{2} c - 4 \, a c^{2}\right )} h x - 2 \, {\left (2 \, c^{2} f - b c g + {\left (b^{2} - 2 \, a c\right )} h\right )} \sqrt {-b^{2} + 4 \, a c} \arctan \left (-\frac {\sqrt {-b^{2} + 4 \, a c} {\left (2 \, c x + b\right )}}{b^{2} - 4 \, a c}\right ) + {\left ({\left (b^{2} c - 4 \, a c^{2}\right )} g - {\left (b^{3} - 4 \, a b c\right )} h\right )} \log \left (c x^{2} + b x + a\right )}{2 \, {\left (b^{2} c^{2} - 4 \, a c^{3}\right )}}\right ] \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [B] Leaf count of result is larger than twice the leaf count of optimal. 488 vs.
\(2 (88) = 176\).
time = 1.29, size = 488, normalized size = 5.30 \begin {gather*} \left (- \frac {\sqrt {- 4 a c + b^{2}} \cdot \left (2 a c h - b^{2} h + b c g - 2 c^{2} f\right )}{2 c^{2} \cdot \left (4 a c - b^{2}\right )} - \frac {b h - c g}{2 c^{2}}\right ) \log {\left (x + \frac {- a b h - 4 a c^{2} \left (- \frac {\sqrt {- 4 a c + b^{2}} \cdot \left (2 a c h - b^{2} h + b c g - 2 c^{2} f\right )}{2 c^{2} \cdot \left (4 a c - b^{2}\right )} - \frac {b h - c g}{2 c^{2}}\right ) + 2 a c g + b^{2} c \left (- \frac {\sqrt {- 4 a c + b^{2}} \cdot \left (2 a c h - b^{2} h + b c g - 2 c^{2} f\right )}{2 c^{2} \cdot \left (4 a c - b^{2}\right )} - \frac {b h - c g}{2 c^{2}}\right ) - b c f}{2 a c h - b^{2} h + b c g - 2 c^{2} f} \right )} + \left (\frac {\sqrt {- 4 a c + b^{2}} \cdot \left (2 a c h - b^{2} h + b c g - 2 c^{2} f\right )}{2 c^{2} \cdot \left (4 a c - b^{2}\right )} - \frac {b h - c g}{2 c^{2}}\right ) \log {\left (x + \frac {- a b h - 4 a c^{2} \left (\frac {\sqrt {- 4 a c + b^{2}} \cdot \left (2 a c h - b^{2} h + b c g - 2 c^{2} f\right )}{2 c^{2} \cdot \left (4 a c - b^{2}\right )} - \frac {b h - c g}{2 c^{2}}\right ) + 2 a c g + b^{2} c \left (\frac {\sqrt {- 4 a c + b^{2}} \cdot \left (2 a c h - b^{2} h + b c g - 2 c^{2} f\right )}{2 c^{2} \cdot \left (4 a c - b^{2}\right )} - \frac {b h - c g}{2 c^{2}}\right ) - b c f}{2 a c h - b^{2} h + b c g - 2 c^{2} f} \right )} + \frac {h x}{c} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [A]
time = 3.62, size = 89, normalized size = 0.97 \begin {gather*} \frac {h x}{c} + \frac {{\left (c g - b h\right )} \log \left (c x^{2} + b x + a\right )}{2 \, c^{2}} + \frac {{\left (2 \, c^{2} f - b c g + b^{2} h - 2 \, a c h\right )} \arctan \left (\frac {2 \, c x + b}{\sqrt {-b^{2} + 4 \, a c}}\right )}{\sqrt {-b^{2} + 4 \, a c} c^{2}} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [B]
time = 0.25, size = 132, normalized size = 1.43 \begin {gather*} \frac {h\,x}{c}+\frac {\ln \left (c\,x^2+b\,x+a\right )\,\left (h\,b^3-g\,b^2\,c-4\,a\,h\,b\,c+4\,a\,g\,c^2\right )}{2\,\left (4\,a\,c^3-b^2\,c^2\right )}+\frac {\mathrm {atan}\left (\frac {b}{\sqrt {4\,a\,c-b^2}}+\frac {2\,c\,x}{\sqrt {4\,a\,c-b^2}}\right )\,\left (h\,b^2-g\,b\,c+2\,f\,c^2-2\,a\,h\,c\right )}{c^2\,\sqrt {4\,a\,c-b^2}} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________